home *** CD-ROM | disk | FTP | other *** search
- -- © 1994-1997 Apple Computer, Inc. All rights reserved.
-
-
- -- Note: We have tried, where possible, to indicate the bare
- -- minimum commands needed to display and manipulate QTVR movies. These commands
- -- are indicated in this color. In many cases the additional scripting provides
- -- error checking and clean-up, resulting in a more robust product, but from a
- -- learning point of view, experimenting with the basics may be helpful. Note that
- -- these lines are not in a condition to copy and paste, they are only pointers.
-
- --=============================================================================
- -- Routines for initializing and cleaning up the Director movie.
- -------------------------------------------------------------------------------
-
- --=============================================================================
- -- StartMovie
- --
- -- Runs at movie start time. Initializes key globals, opens the external code
- -- library, registers the QuickTime VR components, and creates an instance of the
- -- XTVR Xtra.
- -------------------------------------------------------------------------------
- on StartMovieXtra
- global gQTVRInstanceXtra, gPathName, gLastTimeRollover, gTheXtra, gOnPC,Xpath
- put 0 into gQTVRInstanceXtra
- put empty into gPathName
- put false into gLastTimeRollover
-
- -- initialize a flag for handlers that need x-platform differences
- if the machineType = 256 then set gOnPC = true
-
- -- register the Quicktime VR component
- set gTheXtra = xtra "QTVRXtra"
-
-
- QTVREnter(gTheXtra)
-
-
- -- create an object from the QTVR XTRA
- if not VOIDP(gTheXtra) then set gQTVRInstanceXtra = new(gTheXtra)
-
-
-
- -- initialize callbacks on the mac:
- if not gOnPC then
- put CallBackTracer(mNew) into QTVRCallBackFactory
- SetCallBack PanoMovie, QTVRCallBackFactory
- end if
-
- -- ** fileIO code for PC projectors: uncomment the line of code
- -- ** below and include the fileIO xObject ("fileIO.dll") in the
- -- ** same directory as the director movie. See stopMovie also.
- -- openXlib "fileIO.dll"
- end
-
-
- --=============================================================================
- -- StopMovie
- --
- -- Runs at movie stop time. Closes any open pano or nav movies. Disposes
- -- of the XCMD Callback Factory and closes the external code library.
- -------------------------------------------------------------------------------
- on StopMovieXtra
- global gQTVRInstanceXtra, gTheXtra
-
- -- Close any open panoramic or object movies
-
- CloseMovieXtra
-
-
- -- purge the object from memory
- set gQTVRInstanceXtra = 0
-
- -- unregister the Quicktime VR component
-
- QTVRExit(gTheXtra)
-
-
- -- ** fileIO code for PC projectors: uncomment the line of code below:
-
- closeXlib
-
- end
-
-
-
- --=============================================================================
- -- OpenMovie
- -- Opens a QTVR Movie. Relies on a passed filename (complete path), a sprite in the
- -- location desired for the movie, and an indication of wether the movie should
- -- be displayed right away.
- -------------------------------------------------------------------------------
- on OpenMovieXtra pFileName, pSpriteNum, tShowOnOpen
- global gQTVRInstanceXtra, gPathName, gFileName
-
- -- The use of a single global gQTVRInstanceXtra constrains these routines
- -- to only allow one QTVR movie to be open at a time.
-
- -- Close any other open QTVR movie.
- CloseMovieXtra
-
- -- Make the movie display in the rect covered by sprite pSpriteNum
- set tRect = the left of sprite pSpriteNum & "," & the top of sprite pSpriteNum & "," &¬
- the right of sprite pSpriteNum & "," & the bottom of sprite pSpriteNum
-
- -- open the movie
- put QTVROpen(gQTVRInstanceXtra, pFileName, tRect, tShowOnOpen) into tResult
- if tResult contains "error" then
- -- Display the error in the message window
- put tResult
- -- initialize the object
- -- set gQTVRInstanceXtra = 0
- beep
- exit
- end if
-
- -- stash the path to the movie just in case we need to open a linked object movie later
- put pFileName into gFileName
- put ExtractPathNameXtra(pFileName) into gPathName
-
- -- if it's a pano we'll be wanting some callbacks
- if QTVRGetQTVRType(gQTVRInstanceXtra) = "QTVRPanorama" then
- InitPanoCallbacksXtra
- end if
-
- -- don't think we need this... (eric 11/23)
- -- if tShowOnOpen = "visible" then
- -- QTVRUpdate(gQTVRInstanceXtra)
- -- end if
-
- end
-
-
- --=============================================================================
- -- CloseMovie
- --
- -- Disposes an open movie. This does not remove the image from
- -- the screen.
- -------------------------------------------------------------------------------
- on CloseMovieXtra
- global gQTVRInstanceXtra, gVR.MovieOpen
- if IsQTVRMovie(gQTVRInstanceXtra) then
- QTVRClose(gQTVRInstanceXtra)
- end if
- put FALSE into gVR.MovieOpen
- end
-
-
- --=============================================================================
- -- SetMovieView:
- -- pPan is the horizontal pan angle
- -- pTilt is the vertical pan angle
- -- pFOV is the zoom amount
- -- pQuality is the new quality
- --
- -- Sets the movie view to the specified pan angles.
- -------------------------------------------------------------------------------
- on SetMovieViewXtra pPan, pTilt, pFOV, pQuality
- global gQTVRInstanceXtra
-
-
- if IsQTVRMovie(gQTVRInstanceXtra) then
-
- -- in QTVR 1.0 objects can't zoom:
- if QTVRGetQTVRType(gQTVRInstanceXtra) = "QTVRPanorama" then QTVRSetFOV(gQTVRInstanceXtra,pFOV)
-
- QTVRSetTiltAngle(gQTVRInstanceXtra,pTilt)
- QTVRSetPanAngle(gQTVRInstanceXtra,pPan)
- if not voidP(pQuality) then QTVRSetQuality(gQTVRInstanceXtra, pQuality)
- QTVRUpdate(gQTVRInstanceXtra)
- end if
- end
-
-
-
- --=============================================================================
- -- Utility routines
- -------------------------------------------------------------------------------
-
-
- --=============================================================================
- -- ExtractPathName
- -- pFileName is the full file path of the file
- -- Returns the path component of pFileName
- --
- -- Extracts and returns the path component of a file specifier.
- -------------------------------------------------------------------------------
- on ExtractPathNameXtra pPathName
- put ":" into tDelimiter
- if pPathName contains tDelimiter then
- put length(pPathName) into tCharPos
- repeat while tCharPos >= 1
- if char tCharPos of pPathName = tDelimiter then return char 1 to tCharPos - 1 of pPathName
- put tCharPos - 1 into tCharPos
- end repeat
- return empty
- else
- return empty
- end if
- end
-
-
- on resetCallbackCheckboxesXtra
- set the hilite of member "MouseOverHandler Check" = false
- set the hilite of member "RolloverHotSpotHandler Check" = false
- set the hilite of member "MouseDownHandler Check" = false
- set the hilite of member "PanZoomStartHandler Check" = false
- set the hilite of member "MouseStillDownHandler Check" = false
- set the hilite of member "NodeLeaveHandler Check" = false
- end